/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
package eikotrade.javafx.controlls;

import eikotrade.javafx.backendfacades.TestFacade;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;

/**
 *
 * @author michel
 */
public class FindButton extends EikoTradeButton{

    public FindButton(String label, String valueToFind) {
        super(label);
        setOnAction(buildEventHanlder(valueToFind));
    }
    
    private EventHandler buildEventHanlder(final String comparableToFind){
        return new EventHandler<ActionEvent>() {
            
            private Object foundObject = null;

            public void handle(ActionEvent event) {                
                this.foundObject = TestFacade.findObject(comparableToFind);
            }

            public Object getFoundObject() {
                return foundObject;
            }
        };
    }
    
}
